// @ts-ignore
/* eslint-disable */

import { request, type RequestOptions } from '@/utils/request';

/**
 * 获取中国地区数据列表
 * @param input 地区搜索参数
 * @returns
 */
export async function chinas(input: ChinaSearch, options?: RequestOptions) {
  return request<ChinaSearchOut>(`china/chinas`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 获取地区详情
 * @param id 地区ID
 * @returns
 */
export async function get(id: number, options?: RequestOptions) {
  return request<ChinaOut>(`china/${id}`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 获取省市数据
 * @param id 地区ID
 * @returns
 */
export async function provinceAndCity(id: number, options?: RequestOptions) {
  return request<Object>(`china/${id}/province-and-city`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 提交地址信息
 * @param input 地区输入参数
 * @returns
 */
export async function address(input: ChinaInput, options?: RequestOptions) {
  return request<ChinaOut>(`china/address`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}
